<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:menu="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
    mc:Ignorable="d"
    xmlns:Rawr="clr-namespace:Rawr;assembly=Rawr.Base"
    xmlns:local="clr-namespace:Rawr.UI"
    x:Class="Rawr.UI.ItemButtonWithEnchant"
    Width="90" Height="Auto">

    <UserControl.DataContext>
        <Rawr:Character/>
    </UserControl.DataContext>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="20" />
            <RowDefinition Height="20" />
            <RowDefinition Height="30" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <!-- Popups -->
        <Popup x:Name="ListPopup" HorizontalOffset="92" Grid.ColumnSpan="3" Grid.RowSpan="2">
            <local:ItemListControl x:Name="ComparisonItemList"/>
        </Popup>
        <Popup x:Name="ListPopupGem1" HorizontalOffset="22" Grid.Row="0" Grid.Column="1">
            <local:ItemListControl x:Name="ComparisonItemListGem1"/>
        </Popup>
        <Popup x:Name="ListPopupGem2" HorizontalOffset="22" Grid.Row="1" Grid.Column="1">
            <local:ItemListControl x:Name="ComparisonItemListGem2"/>
        </Popup>
        <Popup x:Name="ListPopupGem3" HorizontalOffset="22" Grid.Row="2" Grid.Column="1">
            <local:ItemListControl x:Name="ComparisonItemListGem3"/>
        </Popup>
        <Popup x:Name="EnchantPopup" HorizontalOffset="92" Grid.Row="3">
            <local:ItemListControl x:Name="ComparisonListEnchant"/>
        </Popup>
        <Popup x:Name="TinkerPopup" HorizontalOffset="92" Grid.Row="3">
            <local:ItemListControl x:Name="ComparisonListTinker"/>
        </Popup>
        <Popup x:Name="ReforgePopup" HorizontalOffset="22" Grid.Row="3" Grid.Column="1">
            <local:ItemListControl x:Name="ComparisonListReforge"/>
        </Popup>
        <!-- Buttons -->
        <Button x:Name="MainButton" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="70" Height="70" Margin="0" Click="MainButton_Clicked" MouseEnter="MainButton_MouseEnter" MouseLeave="AnyButton_MouseLeave" Grid.RowSpan="3" MouseRightButtonUp="MainButton_MouseRightButtonUp">
            <menu:ContextMenuService.ContextMenu>
                <menu:ContextMenu x:Name="ContextMenuItem" Opened="ContextMenuItem_Opened">
                    <menu:MenuItem x:Name="ContextItemName" IsEnabled="False" Header="Super Cool Item"/>
                    <menu:Separator/>
                    <menu:MenuItem x:Name="ContextEdit" Header="Edit..." Click="EditItem"/>
                    <menu:MenuItem x:Name="ContextOpenWowhead" Header="Open in Wowhead" Click="OpenInWowhead"/>
                    <!--<menu:MenuItem x:Name="ContextRefreshArmory" Header="Refresh Item from Armory" Click="RefreshItemFromArmory" Visibility="Collapsed"/>-->
                    <menu:MenuItem x:Name="ContextRefreshWowhead" Header="Refresh Item from Wowhead" Click="RefreshItemFromWowhead"/>
                    <!--<menu:MenuItem x:Name="ContextEquip" Header="Equip" Click="EquipItem"/>-->
                    <!--<menu:MenuItem x:Name="ContextAddCustom" Header="Add Custom Gemming..." Click="AddCustomGemming" Visibility="Collapsed"/>-->
                    <!--<menu:MenuItem x:Name="ContextDeleteCustom" Header="Delete Custom Gemming" Click="DeleteCustomGemming" Visibility="Collapsed"/>-->
                    <!--<menu:MenuItem x:Name="ContextEvaluateUpgrade" Header="Evaluate Upgrade..." Click="EvaluateUpgrade"/>-->
                    <!--<menu:MenuItem x:Name="ContextEvaluateUpgradesBySlot" Header="Evaluate Upgrades for this Slot..." Click="EvaluateUpgradesbySlot"/>-->
                    <!--<menu:MenuItem x:Name="ContextRemoveItemFromUpgradeList" Header="Remove Item from Upgrade List" Click="ContextRemoveItemFromUpgradeList_Click"/>-->
                </menu:ContextMenu>
            </menu:ContextMenuService.ContextMenu>
            <Image x:Name="IconImage" Height="Auto" Width="Auto" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="UniformToFill" />
        </Button>
        <Button x:Name="GemButton1" Click="GemButton1_Click" MouseEnter="GemButton1_MouseEnter" MouseLeave="AnyButton_MouseLeave" Grid.Row="0" MinHeight="20" MinWidth="20" MaxWidth="20" MaxHeight="20" Grid.Column="1" HorizontalAlignment="Stretch">
            <Image x:Name="IconImageGem1" Height="Auto" Width="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" />
        </Button>
        <Button x:Name="GemButton2" Click="GemButton2_Click" MouseEnter="GemButton2_MouseEnter" MouseLeave="AnyButton_MouseLeave" Grid.Row="1" MinHeight="20" MinWidth="20" MaxWidth="20" MaxHeight="20" Grid.Column="1" HorizontalAlignment="Stretch">
            <Image x:Name="IconImageGem2" Height="Auto" Width="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" />
        </Button>
        <Button x:Name="GemButton3" Click="GemButton3_Click" MouseEnter="GemButton3_MouseEnter" MouseLeave="AnyButton_MouseLeave" Grid.Row="2" MinHeight="20" MinWidth="20" MaxWidth="20" MaxHeight="20" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Top">
            <Image x:Name="IconImageGem3" Height="Auto" Width="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" />
        </Button>
        <StackPanel Width="70" Margin="0" Grid.Row="3">
            <!--IFSL-->
            <Button x:Name="EnchantButton" Height="17" Width="70" Margin="0" Padding="1" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="10" Click="EnchantButton_Clicked" MouseEnter="EnchantButton_MouseEnter" MouseLeave="AnyButton_MouseLeave" />
            <Button x:Name="TinkerButton" Height="17" Width="70" Margin="0" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="10" Click="TinkerButton_Clicked" MouseEnter="TinkerButton_MouseEnter" MouseLeave="AnyButton_MouseLeave" Padding="2,0" />
            <!--ENDIFSL-->
            <!--IFWPF
            <Button x:Name="EnchantButton" Height="17" Width="70" Margin="0" Padding="0" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="10" Click="EnchantButton_Clicked" MouseEnter="EnchantButton_MouseEnter" MouseLeave="AnyButton_MouseLeave" />
            <Button x:Name="TinkerButton" Height="17" Width="70" Margin="0" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="10" Click="TinkerButton_Clicked" MouseEnter="TinkerButton_MouseEnter" MouseLeave="AnyButton_MouseLeave" Padding="0" />
            ENDIFWPF-->
            <CheckBox x:Name="CK_BSSocket" Height="17" Width="70" Margin="0" VerticalAlignment="Top" HorizontalAlignment="Left" FontSize="9" Checked="BSSocket_Checked" Unchecked="BSSocket_Checked" Content="BS Socket" Padding="1,2,0,0" />
        </StackPanel>
        <Button x:Name="ReforgeButton" Height="17" Width="20" Margin="0" Grid.Row="3" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Right" FontSize="8" Click="ReforgeButton_Click" MouseEnter="ReforgeButton_MouseEnter" MouseLeave="AnyButton_MouseLeave" Padding="1" />
    </Grid>
</UserControl>
